package com.oocl.serviceimpl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.oocl.dao.CustomerDao;
import com.oocl.pojo.Customer;
import com.oocl.service.CustomerService;


@Component(value="serviceImpl")
public class CustomerServiceImpl implements CustomerService{
	
	public CustomerServiceImpl() {
		System.out.println("service实例化...");
	}
	
	@Resource(name="daoImpl")
	private CustomerDao customerDao;

	public void setCustomerDao(CustomerDao customerDao) {
		this.customerDao = customerDao;
	}

	@Override
	public Customer addCustomer(Customer customer) {
		customerDao.add(customer);
		return customer;
	}

	@Override
	public String delCustoemr(String id) {
		customerDao.delete(id);
		return "{}";
	}

	@Override
	public Customer updateCustomer(Customer customer) {
		customerDao.update(customer);
		return customer;
	}

	@Override
	public List<Customer> findAll() {
		List<Customer> list = customerDao.findAll();
		return list;
	}

}
